Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support for reference tag [#153] #154

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

rash805115
Copy link
Contributor

This PR adds support to show @reference tag, which is a custom tag, as discussed in #153

You can use this tag as @reference <Name> {@link <Exported class>}

E.g.

/**
This is class A and does blah.

@reference Resources {@link B}
@reference Models {@link C}
*/
class A {
  ...
}

It would look like,
Screenshot 2024-08-03 at 11 38 27 PM

If your IDE complains about using @reference tag, which is a custom tag not supported in TypeDoc, then you will need to extend their schema definition by putting a new tsdoc.json in the root of your directory.

{
    "$schema": "https://developer.microsoft.com/en-us/json-schemas/tsdoc/v0/tsdoc.schema.json",
    "extends": ["typedoc/tsdoc.json"],
    "noStandardTags": false,
    "tagDefinitions": [
        {
            "tagName": "@reference",
            "syntaxKind": "block",
            "allowMultiple": true
        }
    ]
}

@@ -74,6 +76,37 @@ export default function ApiItem({ readme: Readme, route }: ApiItemProps) {
[nextItem, prevItem],
);

// Add @reference categories.
const referenceCategories: Record<string, { title: string; children: number[] }> = {};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data should probably be built before even making it to the react side of things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Please re-review.

@rash805115 rash805115 changed the title feat: Support for @reference tag [#153] feat: Support for reference tag [#153] Aug 4, 2024
@rash805115
Copy link
Contributor Author

Hi @milesj Can you take a look when you have a chance?

@rash805115
Copy link
Contributor Author

Hello @milesj Can you please review this when you get a chance?

@milesj
Copy link
Owner

milesj commented Sep 1, 2024

Can you post a screenshot of what this looks like in practice?

@rash805115
Copy link
Contributor Author

@milesj The screenshot in PR description is taken from a real example. The new sections Models and Resources are created based on the @reference tag.

@milesj milesj merged commit 6cea7f9 into milesj:master Sep 2, 2024
9 of 10 checks passed
@rash805115 rash805115 deleted the #153-support-reference-tag branch September 2, 2024 00:34
@rash805115
Copy link
Contributor Author

@milesj One last question, how can we release the changes? Is it automatically triggered?

@milesj
Copy link
Owner

milesj commented Sep 2, 2024

I have to manually do it. I'll get around to it later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants